package memory;

import memory.Controller;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.Timer;
import memory.GUI.SquarePanel;

/**
 *
 * @author Scott Robinson
 */
class SquareDisplayHandler implements ActionListener {

    private final SquarePanel presentClick;
    private final SquarePanel previousClick;
    private final Controller cont;

    SquareDisplayHandler(Controller cont, SquarePanel s, Timer timer) {
        this.presentClick = s;
        this.cont = cont;
        previousClick = cont.getLastClicked();
    }

    public void actionPerformed(ActionEvent e) {
        presentClick.setBackground(SquarePanel.DEFAULT_COLOR);
        presentClick.removeNumber();
        previousClick.setBackground(SquarePanel.DEFAULT_COLOR);
        previousClick.removeNumber();
        cont.disableGlassPane();
    }

}
